<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">
        <div class="layui-form-item">
            <label class="layui-form-label">班级</label>
            <div class="layui-input-block">
                <input type="text" name="class_name" class="layui-input"  placeholder="请输入班级名称" value="{$row.class_name|default=''}" lay-verify="required" autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">班级描述</label>
            <div class="layui-input-block">
                <input type="text" name="class_desc" class="layui-input"  placeholder="请输入班级描述" value="{$row.class_desc|default=''}" lay-verify="required" autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">上课时间</label>
            <div class="layui-input-block">
                <input type="text" name="class_time" class="layui-input user1-createTime"   placeholder="请输入上课时间" value="{$row.class_time|default=''}" lay-verify="required" autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">评价截止日期</label>
            <div class="layui-input-block">
                <input type="text" name="evaluate_period_time" class="layui-input user2-createTime"  placeholder="请输入评价截止日期" value="{$row.evaluate_period_time|default=''}" lay-verify="required" autocomplete="off">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">上传学生姓名</label>
            <div class="layui-input-block">

                <input type="hidden" name="student_arr" value=""/>
                <button type="button" class="layui-btn" id="test1">
                    <i class="layui-icon">&#xe67c;</i>上传文件
                </button>
                <a href="/学生上传文件.xlsx">下载上传模板</a>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">校验学生姓名</label>
            <div class="layui-input-block">

                <input type="radio" name="is_check" lay-skin="primary" title="否" value="0" lay-verify="required" checked>
                <input type="radio" name="is_check" lay-skin="primary" title="是" value="1" lay-verify="required" >
            </div>
        </div>
<!--        <div class="layui-form-item">-->
<!--            <label class="layui-form-label">二维码</label>-->
<!--            <div class="layui-input-block">-->
<!--                <img src="{$row.qr_code|default=''}" >-->
<!--            </div>-->
<!--        </div>-->
        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>
<script>


    layui.use(['form', 'laydate','upload'], function () {
        var form = layui.form;
        // layui.use('laydate', function () {
        var laydate = layui.laydate,
            sortObject = {field: 'createTime', type: null},
            createTimeFrom,
            createTimeTo;
        laydate.render({
            elem: '.user1-createTime',
            range: true,
            trigger: 'click',
            type: 'datetime',
            range: '-',
            format: 'yyyy-MM-dd HH:mm:ss',// 'yyyy-MM-dd HH:mm:ss',
            // min:new Date().toLocaleString(),//不能小于当前时间
            // value: new Date(), // 指定值
        });
        laydate.render({
            elem: '.user2-createTime',
            range: true,
            trigger: 'click',
            type: 'date',
            range: '-',
            format: 'yyyy-MM-dd',// 'yyyy-MM-dd HH:mm:ss',
            // min:new Date().toLocaleString(),//不能小于当前时间
            // value: new Date(), // 指定值
        });

        var upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#test1', //绑定元素
            url: '/admin/upload/upload', //上传接口
            method: 'post',
            size: 1024*5, //限定大小
            accept: 'file', //普通文件
            field : 'file',//后端利用request.files['stuInfo']来获取上传的文件
            acceptMime: 'application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',   // 规定打开文件选择框时，筛选出的文件类型，值为用逗号隔开的 MIME 类型列表。
            exts: 'xls|xlsx', //允许上传的文件后缀
            auto: true,//是否选完文件后自动上传。如果设定 false，那么需要设置 bindAction 参数来指向一个其它按钮提交

            done: function(res, index, uploa){
                // console.log(res.data);return false;
                //上传完毕回调
                if(res.code == 0){
                    $("[name='student_arr']").val(res.data);
                    layer.msg(res.msg,{icon:6});

                }

            },error: function(index, upload){
                //请求异常回调
                layer.msg('上传失败',{icon:5});
            }
        });

    })

</script>